<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class ProcessPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $email;

    protected $content;

    protected $title;

    /**
     * Create a new job instance.
     *
     * @param $email
     * @param $title
     * @param $content
     */
    public function __construct($email,$title,$content)
    {
        //

        $this->email=$email;

        $this->content=$content;

        $this->title=$title;


    }


    /**
     * Create by Peter
     * 2020/04/27 11:48:17
     * Email:904801074@qq.com
     */
    public function handle()
    {


//        throw new \Exception('123');

        \Mail::html($this->content, function (\Illuminate\Mail\Message $message) {

            //发送给两个人
            $message->to($this->email);


            $message->subject($this->title);


//            $message->setBody('123');


        });
    }


    function failed(\Exception $exception){

        echo $exception->getMessage();

    }

}
